var preloadImage = function(
    src,      // [required] String
    callback, // [optional] Function(image), image is undefined if error
    scope)    // [optional] Object
{
    var image = new Image();
    jQuery(image).
        load(function() {
            if (callback)
                callback.call(scope, image);
        }).
        error(function() {
            if (callback)
                callback.call(scope);
        }).
        attr("src", src);
}
